#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
int main()
{
	int i,j;
	int m,n;
	int x=10,y=20;
	int v_x=1,v_y=1;
	int left=0,right=20;
	int top=0,bottom=10;
	while(1)
	{	
		x=x+v_x;
		y=y+v_y;
		system("cls");
		for(i=1;i<=bottom;i++)
		{
			for (j=0;j<=right;j++)
			{
				if(i==x &&j==y)			
					printf("o");
				else if (i==1||i==bottom||j==0||j==right)	
					printf("#");
				else	
					printf(" ");
			}
			printf("\n");
		}
		if(x>bottom||x<top)
			v_x=-1*v_x;
		if(y>right||y<left)
			v_y=-1*v_y;
		if(x==bottom||x==top||y==right||y==left)
			printf("\a");
		Sleep(20);
	}
	return 0;
}